package org.shoukaiseki.aqoeous.service.impl;

import com.github.pagehelper.PageHelper;
import org.shoukaiseki.aqoeous.exception.ResultException;
import org.shoukaiseki.aqoeous.model.ShopVO;
import org.shoukaiseki.aqoeous.model.qo.ShopQO;
import org.shoukaiseki.aqoeous.module.mapper.db1.ShopVOMapper;
import org.shoukaiseki.aqoeous.scan.Aqoeous;
import org.shoukaiseki.aqoeous.service.IAqoeous;
import org.shoukaiseki.aqoeous.service.ShopQueryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * org.shoukaiseki.aqoeous.service.impl.ShopQueryServiceImpl
 * <br>
 *
 * @author 蒋カイセキ    Japan-Tokyo  19-2-11 下午4:46<br>
 * ブログ http://www.shoukaiseki.top/<br>
 * E-メール jiang28555@Gmail.com<br>
 **/
@Service
@Aqoeous(qoClass = ShopQO.class)
public class ShopQueryServiceImpl implements ShopQueryService,IAqoeous {

    @Resource
    ShopVOMapper shopVOMapper;

    @Override
    public List<ShopVO> selectShopVOList(ShopQO shopQO) {
        if(shopQO==null){
            return null;
        }

//        PageHelper.startPage(shopQO.getPageNum(), shopQO.getPageSize(), true);
        return shopVOMapper.selectShopVOList(shopQO);
    }

    @Override
    public List<?> aqoeous(Object qo) {
        if(qo instanceof ShopQO){
            return selectShopVOList((ShopQO) qo);
        }else{
            throw new ResultException("qo {} 错误").format("shopQO");
        }
    }

}
